VueJS Plugins Examples 
  
  Some VueJS plugins examples ad-hoc designed on the default BIMData basic plugins. 
   Pick stratigraphic units in order to annotate archaeological units on the model; Isolate Elements for graphically quarying objects and their classification; Modals for the purpose of adding information via pop-up windows. 
   
  
    Pick Stratigraphic Units 
    
viewer.registerPlugins([{
    name: "Pick Stratigraphic units",
    component: {
        template: `
        
		
Pick stratigraphic units 
          
		     
            Stratigraphic Units 
			 
            US 
            USR 
            USM 
             
            Help 
			 
			Remove selected unit 
			 
			Remove all units 
        
        `,
        data() {
            return {
                priority: "",
                pickSubscription: null,
                index: 1
            };
        },
        methods: {
            onLink_0Click() {
                this.$plugins.modalManager.pushModal({
                    template: `
                
				Pick stratigraphic units - help 
				1) Select stratigraphic units typology and units number
			    2) Pick units on highlight object of the model
				3) Picked units will appear on the objects center of mass
				 
				
- Press "Remove selected units" button in order to delete selected unit (object must be selected)
				- Press "Remove all units" button in order to delete ALL units
								 
				
ATTENTION! 
				This tool has no memory and then no save option! Once you finished picking units you can save a screeshot
                 `
                })
            },
            onLink_1Click() {
                this.$hub.emit("delete-annotations", {
                    ids: this.$utils.getSelectedObjectIds()
                });
            },
            onLink_2Click() {
                this.$hub.emit("clear-annotations")
            },
        },
        props: ["active"],
        watch: {
            active: {
                handler(active) {
                    const viewer3D = this.$plugins.viewer3D;
                    viewer3D.selectOnClick = !active;
                    // viewer3D.highlightOnHover = !active; // To remove the highlight on hover
                    if (active) {
                        document.body.style.setProperty("cursor", "copy", "important");
                        this.pickSubscription = viewer3D.xeokit.cameraControl.on(
                            "picked",
                            pickResult => {
                                if (!this.priority) {
                                    return this.$hub.emit('alert', {
                                        type: 'warning',
                                        message: 'Please select a stratigraphic units typology'
                                    });
                                }
                                if (!pickResult || !pickResult.entity) return;
                                this.$hub.emit("create-annotations", {
                                    ids: [pickResult.entity.id],
                                    index: this.index,
                                    priority: this.priority
                                });
                            }
                        );
                    }
                }
            }
        }
    },
    display: {
        iconPosition: "left",
        content: "simple"
    },
    icon: {
        imgUri: 'https://img.icons8.com/ios-filled/35/000000/circled-dot.png'
    },
    keepActive: true,
    tooltip: "stratigraphic.tooltip",
    i18n: {
        en: {
            stratigraphic: {
                tooltip: "Pick Stratigraphic Units",
            }
        }
    },
}])
	 
	
   
  
  
    Isolate Elements 
    
 viewer.registerPlugins([{
    name: "Isolate Elements",
    component: {
        template: `
        
         Walls 
		Columns 
		Footings 
		Windows 
		Beams 
		Slabs 
		Stairs 
		Doors 
		Furnitures 
		Building Element 
		Roof 	    
        Reset scene 
        
`,
        methods: {
            onIsolateWallsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("wall")
                        .map(object => object.uuid)
                });
            },
            onIsolateColumnsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("column")
                        .map(object => object.uuid)
                });
            },
            onIsolateFootingsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("footing")
                        .map(object => object.uuid)
                });
            },
            onIsolateBeamsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("beam")
                        .map(object => object.uuid)
                });
            },
            onIsolateSlabClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("slab")
                        .map(object => object.uuid)
                });
            },
            onIsolateStairsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("stair")
                        .map(object => object.uuid)
                });
            },
            onIsolateDoorsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("door")
                        .map(object => object.uuid)
                });
            },
            onIsolateFurnituresClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("furnishing_element")
                        .map(object => object.uuid)
                });
            },
            onIsolateElementClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("building_element")
                        .map(object => object.uuid)
                });
            },
            onIsolateWindowsClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("window")
                        .map(object => object.uuid)
                });
            },
            onIsolateRoofClick() {
                this.$hub.emit("isolate-objects", {
                    ids: this.$utils.getAllObjectsOfType("roof")
                        .map(object => object.uuid)
                });
            },
            onUnisolateClick() {
                this.$hub.emit("unisolate-all-objects");
            }
        }
    },
    display: {
        iconPosition: 'left',
        content: 'simple'
    },
    icon: {
        imgUri: 'https://img.icons8.com/ios-filled/35/000000/select-cell.png',
    },
    keepActive: true,
    tooltip: "myCustomPlugin.tooltip",
    i18n: {
        en: {
            myCustomPlugin: {
                tooltip: "Isolate Elements",
            }
        },
    }
}]);
	 
   
  
    Modals 
    
        viewer.registerPlugins([{
        name: "modals",
        component: {
        render() {
            return null;
        },
        created() {
            this.$plugins.modalManager.pushModal({
            template: `
                `
            });
         },
        },
        }]);